package net.html;

import javax.swing.JEditorPane;
import javax.swing.event.HyperlinkEvent;
import javax.swing.event.HyperlinkListener;

public class LinkFollower implements HyperlinkListener
{
	private JEditorPane pane;
	public LinkFollower(JEditorPane pane)
	{
		this.pane = pane;
	}
	@Override
	public void hyperlinkUpdate(HyperlinkEvent e)
	{
		if(e.getEventType()==HyperlinkEvent.EventType.ACTIVATED)
		{
			try
			{
				pane.setPage(e.getURL());
			}
			catch (Exception e2)
			{
				pane.setText("error");
			}
		}
	}
	
}
